<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*,java.util.*,java.io.*" errorPage="" %>
<%@ page import="com.Const"%>


<%
		String filename = request.getParameter("fileName").trim();
		java.io.BufferedInputStream bis = null;
		java.io.BufferedOutputStream bos = null;
		
		try {
			response.reset();
			response.setContentType("application/x-msdownload;charset=UTF-8");
			String f = filename.substring(filename.lastIndexOf("/")+1);
			response.setHeader("Content-disposition",
					"attachment;filename=" + f);
			bis = new java.io.BufferedInputStream(
					new java.io.FileInputStream(Const.server_path+ filename));
			bos = new java.io.BufferedOutputStream(
					response.getOutputStream());
			byte[] buff = new byte[2048];
			int bytesRead;
			while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
				bos.write(buff, 0, bytesRead);
			}
		} catch (Exception e) {

		} finally {
			if (bis != null)
				bis.close();
			if (bos != null)
				bos.close();

		}
	
%>